<?php
namespace Admin\Model;

use Think\Model\RelationModel;

class ArticleModel extends RelationModel
{

    protected $_validate = array(
        array('category_id', 'number', '请选择父栏目！'),
        array('title', 'require', '请填写标题！'),
        array('thumb', 'require', '请上传缩略图！'),
        array('content', 'require', '内容不能为空！'),
    );

    protected $_auto = array(
        array('time','getTime',3,'callback'),
    );

    protected $_link = array(
        'category' => array(
            'mapping_type' => self::BELONGS_TO,
        )
    );

    protected function getTime($time){
        return strtotime($time);
    }

}